import { LocalizationContext, MenuItem } from "../../core";

import DownArrowIcon from "./DownArrowIcon";
import { RenderGoToPageProps } from "./types/index";
import { FC, useContext } from "react";

const GoToLastPageMenuItem: FC<RenderGoToPageProps> = ({
  isDisabled,
  onClick,
}) => {
  const l10n = useContext(LocalizationContext);
  const label =
    l10n && l10n.pageNavigation
      ? l10n.pageNavigation.goToLastPage
      : "Last page";

  return (
    <MenuItem
      icon={<DownArrowIcon />}
      isDisabled={isDisabled}
      onClick={onClick}
    >
      {label}
    </MenuItem>
  );
};

export default GoToLastPageMenuItem;
